#include <cjson/cJSON.h>
#include "http_client.h"
#include "json_analysis.h"
#include <stdio.h>
#include <string.h>

#define BASE_URL "https://estudy.umsin.com"
static const char * queryAlbumTags_Url = BASE_URL "/api/kuwo/getAlbumTags";
static const char * queryHomeData_Url = BASE_URL "/api/kuwo/getHomeData";

/**
 * 专辑分类获取标签
 * @param void
 * @return 专辑分类标签
 */
cJSON *queryAlbumTags(void) {
    cJSON *json = get_query(queryAlbumTags_Url);

    char *result = getCJSONString(json, "result");
    printf("result: %s\n", result);
    int code = getCJSONInt(json, "code");
    printf("code: %d\n", code);
    int resultCode = getCJSONInt(json, "resultCode");
    printf("completed: %s\n", resultCode != 0 ? "true" : "false");


    return json;
}

/**
 * 首页获取主题列表
 * @param void
 * @return 首页主题列表
 */
cJSON *queryHomeData(void) {
    cJSON *json = get_query(queryHomeData_Url);
    char *result = getCJSONString(json, "result");
    printf("result: %s\n", result);

    return json;
}
